package map;

import java.util.*;

public class LinkedHashMapDemo {
    public static void main(String[] args) {

        Map<String,Integer> map=new LinkedHashMap<>(10,0.75f,true);
        map.put("张三",100);
        map.put("李四",67);
        map.put("赵五",56);
        System.out.println(map);
        map.put("赵五",45);
        System.out.println(map);
        Set<String>keyset=map.keySet();
        for(String key:keyset){
            System.out.println("key:"+key);
        }

        keyset.forEach(key->System.out.println("key:"+key));

        Collection<Integer>values=map.values();
        for(Integer value1:values){
            System.out.println("value:"+value1);
        }

        values.forEach(value->System.out.println("value:"+value));

        Set<Map.Entry<String,Integer>>entryset=map.entrySet();
        for(Map.Entry<String,Integer>entry:entryset){
            System.out.println(entry.getKey()+","+entry.getValue());}

        entryset.forEach(entry->System.out.println(entry.getKey()+","+entry.getValue()));

    }
}